/**
 * @author Aaron
 * @createTime 18:10 2022/5/26
 **/
package api

import (
	"github.com/labstack/echo/v4"
	"longmen/server/pkg/common/api_models"
	"longmen/server/pkg/common/services"
	"longmen/server/pkg/common/helper/util"
)

// @Summary 道具列表
// @Description 道具列表
// @Accept  json
// @Produce  json
// @Tags Gift
// @Success 200 {object} api_models.Props "result"
// @Router /api/prop/getPropList [POST]
func (base *Controller) GetPropList(c echo.Context) error {
	r := &api_models.GetPropsReq{}
	if err := util.Json2Struct(c.Get("body").(string), r); err != nil {
		return util.BadParam(c, err)
	}
	props, err := services.GetPropList(r.PropsType)
	if err != nil {
		return util.BuildFail(c, 1, "", err)
	}
	return util.BuildSuccess(c, props, "")
}
